Developing an HTML5 Brick-breaker Game With Phaser by Palacios Jorge

Developing an HTML5 Brick-breaker Game With Phaser by Palacios Jorge

Author:Palacios, Jorge
Language: eng
Format: epub
Published: 2015-05-18T16:00:00+00:00


Set the background music to loop and play: 1 this.bgmMusic.loop = true; 2 this.bgmMusic.play();

Create a new function to be triggered when the ball collides with the paddle and plays the sound: 1 hitPaddle: function (ball, paddle) { 2 this.sfxHitPaddle.play(); 3 }

Modify the function to check the collision: 1 game.physics.arcade.collide(this.ball, this.paddle); 2 game.physics.arcade.collide(this.ball, this.paddle, this.hitPaddle, null, this);

Play the sound when the ball is shot, in the shootBall function: 1 this.sfxHitPaddle.play();



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.